/**
 * 推荐item
 */
class BoxRenderUI extends BaseComp{
    private item:eui.Group;
    private img_icon:eui.Image;
    private img_mask:eui.Rect;
    constructor(data)
    {
        super('BoxRenderView',data);
    }

    public addEvent()
    {
        this.item.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandle, this);
    }

    public init()
    {
        if(GlobalManager.instance().isWindows())return;
        this.updateUI();
    }

    public updateUI()
    {
        let data = this.data;
        if(data)
        {
            this.img_icon.source = data.icon;
            this.img_icon.width = this.img_icon.height = 110;
            this.img_icon.mask = this.img_mask;
        }
    }

    public touchHandle()
    {
        let data = this.data;
        if(data)
        {
            let appid  = data.appid;
            if(appid)
            WeChatgGameManager.instance().navigateToMiniProgram(appid);
        }   
    }

    public removeEvent()
    {
        this.item.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandle, this);
    }

    public clear()
    {
        super.clear();
    }
}

window['BoxRenderUI'] = BoxRenderUI;